
# ifndef __DFX_LOG_H__
# define __DFX_LOG_H__

# include "dfxSingleton.h"

# define DFX_INFO(format, ...)      Log::GetPtr()->Write(LOG_TYPE_INFO, __BASE_FILE__, __LINE__, format, __VA_ARGS__)
# define DFX_WARNING(format, ...)   Log::GetPtr()->Write(LOG_TYPE_WARNING, __BASE_FILE__, __LINE__, format, __VA_ARGS__)
# define DFX_ERROR(format, ...)     Log::GetPtr()->Write(LOG_TYPE_ERROR, __BASE_FILE__, __LINE__, format, __VA_ARGS__)

namespace DFX
{
    enum LOG_TYPE
    {
        LOG_TYPE_INFO = 0,
        LOG_TYPE_WARNING,
        LOG_TYPE_ERROR
    };

    class DFX_EXPORT Log : public Singleton<Log>
    {
    protected:

        UInt32 mLogLevel;

    public:

        Log(UInt32 logLevel)
            : mLogLevel(logLevel)
        {
        }

        virtual ~Log()
        {
        }

        UInt32 GetLogLevel() const
        {
            return mLogLevel;
        }
        
        virtual void Write(LOG_TYPE logType, const String &fileName, UInt32 lineNo, char *format, ...) = 0;
    };
}

# endif